﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using ExamDemo.Models;

namespace ExamDemo.Data
{
    public class Datalnitlizer : DropCreateDatabaseIfModelChanges<ExamDemoDb>
    {
        protected override void Seed(ExamDemoDb db)
        {
            //用户
            db.Users.AddRange(new List<Users>
            {
                new Users
                {
                    Username="达咩",
                    Password="123"
                }
            });

            //发布的说说
            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="差不多得了"
                } 
            });

            //评论
            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    FromUserId=1,
                    Id=1,
                    Comment=""
                }
            });

            db.SaveChanges();

            base.Seed(db);
        }
    }
}
